package com.theatre.userservice.Controller.contxet;

public class BaseContext {

    // roleId
    private static final ThreadLocal<Long> currentRoleId = new ThreadLocal<>();
    // userId
    private static final ThreadLocal<Long> currentUserId = new ThreadLocal<>();

    // roleId 操作
    public static void setCurrentId(Long id) {
        currentRoleId.set(id);
    }

    public static Long getCurrentId() {
        return currentRoleId.get();
    }

    public static void removeCurrentId() {
        currentRoleId.remove();
    }

    // userId 操作
    public static void setUserId(Long userId) {
        currentUserId.set(userId);
    }

    public static Long getUserId() {
        return currentUserId.get();
    }

    public static void removeUserId() {
        currentUserId.remove();
    }
}
